using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public struct EnumArray<E, V>: IEnumerable where E: struct
{
    private V[] data;

    public EnumArray(int len)
    {
        data = new V[len];
    }

    public int Length
    {
        get => data.Length;
    }

    public V this[E index]
    {
        get => data[Convert.ToInt32(index)];
        set => data[Convert.ToInt32(index)] = value;
    }

    public V this[int index]
    {
        get => data[index];
        set => data[index] = value;
    }

    public IEnumerator GetEnumerator()
    {
        return data.GetEnumerator();
    }
}
